from config import settings
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager

db = SQLAlchemy()
app = Flask(__name__)

jwt = JWTManager()


def init_app():
    app.config.update(settings.FLASK_CONFIG)
    db.init_app(app)
    jwt.init_app(app)
    with app.app_context():
        db.create_all()
    return app
